home *** CD-ROM | disk | FTP | other *** search
/ 3D Games - Real-time Rend…ng & Software Technology / 3D Games - Real-time Rendering & Software Technology.iso / flysdk / plugin / gamelib / explode.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-02-02  |  1.6 KB  |  86 lines

  1. #include "..\..\lib\Fly3D.h"
  2. #include "gamelib.h"
  3.  
  4. void explode::do_explode(vector& pos,vector& z,int fromplayer)
  5. {
  6.     if (directx->mpmode!=FLYMP_SERVER)
  7.     {
  8.     if (e)
  9.         {
  10.         exp_sphere *x=(exp_sphere *)e->clone();
  11.         x->pos=pos;
  12.         flyengine->activate(x);
  13.         }
  14.     if (s)
  15.         {
  16.         sprite_light *x=(sprite_light *)s->clone();
  17.         x->pos=pos;
  18.         x->align_z(z);
  19.         flyengine->activate(x);
  20.         }
  21.     if (l)
  22.         {
  23.         light *x=(light *)l->clone();
  24.         x->pos=pos;
  25.         flyengine->activate(x);
  26.         }
  27.     if (ps)
  28.         {
  29.         particle_system *x=(particle_system *)ps->clone();
  30.         x->pos=pos;
  31.         x->align_z(z);
  32.         flyengine->activate(x);
  33.         }
  34.  
  35.     if (snd) 
  36.         snd->add_sound_clone(&pos,0);
  37.     }
  38.     
  39.     if (damage>0 && damageradius>0)
  40.         flyengine->send_bsp_message(flyengine->bsp,pos,damageradius,FLYOBJM_DAMAGE,fromplayer,&damage);
  41. }
  42.  
  43. int explode::get_custom_param_desc(int i,param_desc *pd)
  44. {
  45.     if (pd!=0)
  46.     switch(i)
  47.     {
  48.         case 0:
  49.             pd->type='f';
  50.             pd->data=&damage;
  51.             strcpy(pd->name,"damage");
  52.             break;
  53.         case 1:
  54.             pd->type='f';
  55.             pd->data=&damageradius;
  56.             strcpy(pd->name,"damageradius");
  57.             break;
  58.         case 2:
  59.             pd->type=TYPE_SPRITE_LIGHT;
  60.             pd->data=&s;
  61.             strcpy(pd->name,"sprite");
  62.             break;
  63.         case 3:
  64.             pd->type=TYPE_LIGHT;
  65.             pd->data=&l;
  66.             strcpy(pd->name,"light");
  67.             break;
  68.         case 4:
  69.             pd->type=TYPE_SOUND;
  70.             pd->data=&snd;
  71.             strcpy(pd->name,"sound");
  72.             break;
  73.         case 5:
  74.             pd->type=TYPE_PARTICLE_SYSTEM;
  75.             pd->data=&ps;
  76.             strcpy(pd->name,"ps");
  77.             break;
  78.         case 6:
  79.             pd->type=TYPE_EXP_SPHERE;
  80.             pd->data=&e;
  81.             strcpy(pd->name,"expsphere");
  82.             break;
  83.     }
  84.     return 7;
  85. }
  86.